package cpm.atguigu.gulimall.seckill.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//public class SimpleJDKDynamicProxyDemo {
//    static interface IService {
//        public void sayHello();
//    }
//    static class RealService implements IService {
//        @Override
//        public void sayHello() {
//            System.out.println("hello");
//        }
//    }
//    static class SimpleInvocationHandler implements InvocationHandler {
//        private Object realObj;
//        public SimpleInvocationHandler(Object realObj) {
//            this.realObj = realObj;
//        }
//        @Override
//        public Object invoke(Object proxy, Method method,
//                             Object[] args) throws Throwable {
//            System.out.println("entering " + method.getName());
//            Object result = method.invoke(realObj, args);
//            System.out.println("leaving " + method.getName());
//            return result;
//        }
//    }
//    public static void main(String[] args) {
//        IService realService = new RealService();
//        IService proxyService = (IService) Proxy.newProxyInstance(
//                IService.class.getClassLoader(), new Class<?>[] { IService.class },
//                new SimpleInvocationHandler(realService));
//        proxyService.sayHello();
//    }
//}